Repository navigation
feat(core): add G502 HERO gaming layout - #2293
MikiDevAHM wants to merge 10 commits into
Conversation
Confidence Score: 3/5
[Medium impact] The changes reach G502 HERO button mapping and shared device-asset workflows. The PR still needs the missing resolver regression test and the required test counter-proof before merging. Findings
|
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
35d1150 to
b421809
Compare
| if let Some(parent) = dst.parent() { | ||
| std::fs::create_dir_all(parent).map_err(fail)?; | ||
| } |
There was a problem hiding this comment.
Nested downloads lack regression tests
Blocking. The repository requires each bug fix to have a regression test that fails without it. The new safe_component_path assertion only compares paths. Both existing write_replace tests use an existing parent directory, and every is_optional_asset test uses a flat name. Those tests still pass if parent creation or nested side-render selection is removed.
Add write_replace_creates_nested_parents and nested_side_render_is_optional, then record which reverted lines make them fail in the PR.
Rule Used: Severity: medium. Every bug fix ships a regression test that fails without the fix, and the PR states the counter-proof (the reverted line or the killed mutant). A test that passes with the fix reverted is not a regression test: ask for inputs where ... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Hardware check on Windows, since the PR notes the per-button labels were not confirmed one by one. Setup
That matches the One difference: my unit reports Remapping: with this build every remappable button works: wheel click, back, forward, G6 to G9 and both wheel tilts. GUI: with this PR alone the Buttons panel showed 6 of the 9 remappable buttons. Not measured: stock DPI presets. |
0595ed8 to
402ae8d
Compare
|
@iahoeu I implemented the suggested fix, and it’s working perfectly for me. |
5dbf4bf to
0a83bde
Compare
| let variant = manifest | ||
| .and_then(|m| find_variant_in_manifest(m, entry, depot, extended_model_id, side_image_for)); |
There was a problem hiding this comment.
Side-view fix lacks regression coverage. Blocking. Add a test such as
depot_named_nested_side_view_resolves that calls AssetResolver::resolve with a depot-named manifest entry, a nested side render, and no side.png. Assert the returned side_view path and dimensions.
I checked the existing tests: the depot-named base render uses side.png, which the old fallback already finds; the drawable colour test never checks side_view; and the WebP test uses a registry model ID. None catches removal of this depot-name lookup. The repository requires every bug fix to include a test that fails without it. Record that counter-proof in the PR too.
Rule Used: Severity: medium. Every bug fix ships a regression test that fails without the fix, and the PR states the counter-proof (the reverted line or the killed mutant). A test that passes with the fix reverted is not a regression test: ask for inputs where ... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
@MikiDevAHM Tested the current head on my G502 HERO. The side view now resolves with this PR alone. Setup
Result
Not tested
|


Summary
Adds a
GamingLayoutfor the wired Logitech G502 HERO (HID++ model key0c08b), so its extra buttons (G6–G9, wheel tilts) become remappable through host mode and the Buttons panel renders the full 11-button silhouette instead of only the 5 OS-hook buttons. The device was already detected; the missing piece was the per-model0x8110slot table.Device
G502 HERO Gaming Mouse)Changes
crates/openlogi-core/src/binding/gaming.rs: addedG502_HEROGamingLayout(model key0c08b, 11 slots) and registered it inLAYOUTS; added a resolving test.crates/openlogi-core/src/binding.rs: re-exportedG502_HERO.Hardware verification
CLI output (before / after): feature table unchanged (19 entries incl. 0x8100/0x8110);
diag mouse-buttonsmeasuredslots: 11, host-mode mapping01 02 03 04 05 06 07 08 09 0a 0b.Testing
cargo fmt --all -- --check— passcargo clippy -p openlogi-core -p openlogi-agent-core -p openlogi-desktop --all-targets -- -D warnings— passcargo test -p openlogi-core— 488 passedcargo test -p openlogi-agent-core— 842 passedcargo test -p openlogi-desktop(geometry) — 21 passedcargo check -p openlogi-core --no-default-features --target wasm32-unknown-unknown— passRUSTDOCFLAGS="-D warnings" cargo doc -p openlogi-core --no-deps --document-private-items— passcargo xtask ci ast-grep/typos— skipped (tools not installed on this host)Notes for reviewers
ButtonIdmapping mirrorsG502_LIGHTSPEEDbecause the G502 HERO has the same physical button layout and the same identity host-mode mapping (01..0b). The slot count and host-mode mapping were measured on real hardware; the per-slotButtonIdassignment follows the shared physical layout and was not independently re-verified button-by-button. If a reviewer with a G502 HERO finds a button mislabeled, theslotsarray is the only thing to adjust.stock_dpi_presetsis left empty: the on-mouse ROM profile 1 DPI levels were not read on this hardware, so the DPI cycle falls back to user-configured presets rather than guessing.0c08bentry for a photo to show. Flagging for maintainers.Warning to reviewers
During verification, the Buttons panel initially showed only 6 of 11 buttons. Root cause: the asset depot
g502_herostores its side render at a nested path (images/device/side_hero.png), butsafe_component_pathrejected any path containing/, so the runtime sync could never fetch it andresolve_side_viewreturnedNone. I added a second commit to this PR that makessafe_component_pathaccept nested (but traversal-safe) paths andwrite_replacecreate parent directories; the sync now fetchesside_hero.pngsuccessfully and all 11 buttons render. The change is security-reviewed (each path component is validated as a normal segment;..,., empty segments and backslashes are still rejected), but please double-check the security implications. The corresponding test was updated to reflect the new (still safe) contract.AI assistance
Prepared with an AI coding agent; verified on real hardware by the contributor.